package com.bgy.geek.controller;

import com.bgy.geek.dto.LineDTO;
import com.bgy.geek.dto.ProjectDTO;
import com.bgy.geek.service.HomeService;
import com.bgy.geek.vo.PostWorkerVO;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * 首页数据
 *
 * @author: dengjianwu
 * @version: 1.0
 * @date: 2021/10/22 10:17
 */
@RestController
@RequestMapping("/home")
public class HomeController {

	@Resource
	private HomeService homeService;

	/**
	 * 查询首页数量
	 * @return
	 */
	@GetMapping("/findCount")
	public Map<String,Integer> homeAmount(String currentBip){
		return homeService.homeAmount(currentBip);
	}


	@GetMapping("/findLine")
	public List<LineDTO> findLine(LineDTO lineDTO){
		return homeService.findLine(lineDTO);
	}

	@GetMapping("/findPostWorkers/{bip}")
	public Object findPostWorkers(@PathVariable(name = "bip") String bip) {
		List<PostWorkerVO> postWorkers = homeService.findPostWorkers(bip);

		return postWorkers;
	}

	@GetMapping("/findProject")
	public List<ProjectDTO> findProject(ProjectDTO projectDTO){
		return homeService.findProject(projectDTO);
	}

}
